package com.aspose.cells;

class zc extends zbz {
   zc() {
      this.c(4177);
   }

   void a(int var1) {
      this.b(8);
      this.c = new byte[8];
      this.c[0] = (byte)var1;
      this.c[1] = 1;
   }

   void a() {
      this.b(8);
      this.c = new byte[8];
      this.c[1] = 1;
   }

   void a(byte[] var1) {
      if (var1 == null) {
         this.b(8);
         this.c = new byte[8];
         this.c[1] = 1;
      } else {
         this.a((short)(var1.length + 6));
         this.c = new byte[this.d()];
         this.c[1] = 2;
         System.arraycopy(var1, 0, this.c, 6, var1.length);
      }

   }

   void a(DataLabels var1, WorksheetCollection var2, int var3, byte[] var4) {
      this.b(6);
      if (var4 != null && var4.length != 0) {
         this.a((short)(this.d() + var4.length));
      } else {
         this.b(this.d() + 2);
      }

      this.c = new byte[this.d()];
      this.c[1] = 1;
      if (!var1.getNumberFormatLinked() || var1.getShowPercentage()) {
         if (var1.getNumberFormat() != null && !"".equals(var1.getNumberFormat())) {
            this.c[2] = 1;
            int var5 = var1.G();
            System.arraycopy(com.aspose.cells.b.a.zc.a(var5), 0, this.c, 4, 2);
         } else if (var1.G() > 0) {
            this.c[2] = 1;
            System.arraycopy(com.aspose.cells.b.a.zc.a(var1.getNumber()), 0, this.c, 4, 2);
         }

         if (var1.getShowPercentage() && this.c[2] != 1) {
            this.c[2] = 1;
            this.c[4] = 9;
         }
      }

      if (var4 != null && var4.length != 0) {
         this.c[1] = 2;
         System.arraycopy(var4, 0, this.c, 6, var4.length);
      }

   }

   void a(Chart var1, Series var2, WorksheetCollection var3, int var4, zqa var5) throws Exception {
      Object var6 = var2.k();
      if (var6 == null || var6 instanceof String && "".equals((String)var6)) {
         this.b(8);
         this.c = new byte[8];
         this.c[1] = 1;
         this.a(var5);
      } else if (var6 instanceof String) {
         this.b(8);
         this.c = new byte[8];
         this.c[1] = 1;
         this.a(var5);
         this.a(var3.l(), (String)var6, var5);
      } else {
         if (var6 instanceof byte[]) {
            byte[] var7 = (byte[])((byte[])var6);
            this.a((short)(6 + var7.length));
            this.c = new byte[this.d()];
            this.c[1] = 2;
            System.arraycopy(var7, 0, this.c, 6, var7.length);
            this.a(var5);
            byte var8 = 2;
            int var9 = com.aspose.cells.b.a.zc.e(var7, var8 + 1) & '\uffff';
            var4 = var3.q().d(var9);
            if (var4 < 0 || var4 >= var3.getCount()) {
               if (var2.b != null) {
                  this.a(var3.l(), var2.b, var5);
               }

               return;
            }

            Worksheet var10 = var3.get(var4);
            Cells var11 = var10.getCells();
            int var12 = com.aspose.cells.b.a.zc.e(var7, var8 + 3) & '\uffff';
            byte var13 = var7[var8 + 5];
            Cell var14 = var11.checkCell(var12, var13 & 255);
            String var15 = var14 == null ? "" : var14.j();
            this.a(var3.l(), var15, var5);
         }

      }
   }

   void a(byte var1, zik var2, int var3, zqa var4, int var5) throws Exception {
      var4.c(4177);
      if (var2 == null) {
         var4.c(8);
         var4.a(var1);
         if (var1 != 2) {
            var4.a((byte)1);
         } else {
            var4.a((byte)0);
         }

         var4.c(0);
         var4.a((int)0);
      } else {
         switch(var2.q()) {
         case 1:
         case 6:
            var4.c(8);
            var4.a(var1);
            var4.a((byte)1);
            var4.c(0);
            var4.a((int)0);
            break;
         case 2:
            var4.c(15);
            var4.a(var1);
            var4.a((byte)2);
            if (var1 == 1) {
               var4.c(0);
               var4.a((short)var5);
            } else {
               var4.a((int)0);
            }

            var4.a(var2.f());
            break;
         case 3:
            var4.c(19);
            var4.a(var1);
            var4.a((byte)2);
            if (var1 == 1) {
               var4.c(0);
               var4.a((short)var5);
            } else {
               var4.a((int)0);
            }

            var4.a(var2.f());
            break;
         case 4:
         case 5:
            byte[] var6 = var2.f();
            var4.a((short)(var6.length + 6));
            var4.a(var1);
            var4.a((byte)2);
            var4.a((int)0);
            var4.a(var6);
            break;
         default:
            throw new Exception("Invalid ASeries values/xvalues/bubble sizes.");
         }

      }
   }

   void b(Chart var1, Series var2, WorksheetCollection var3, int var4, zqa var5) throws Exception {
      this.a(var1, var2, var3, var4, var5);
      this.a((byte)1, var2.l(), var4, var5, var2.c);
      this.a((byte)2, var2.m(), var4, var5, 0);
      if (ChartCollection.q(var2.getType())) {
         this.a((byte)3, var2.n(), var4, var5, 0);
      } else {
         this.a((byte)3, (zik)null, var4, var5, 0);
      }

   }

   private void a(int var1, String var2, zqa var3) throws Exception {
      zbcw var4 = new zbcw(var1, var2);
      var4.a(var3);
   }
}
